#include<iostream>
#include<stdio.h>
using namespace std;
const int N = 100;
struct S
{
	double av;
	double sum ;
	double arr[N];
};
int n, m;
double sum;
int main()
{
	while (cin >> n >> m) {	
		S s[N];
		double av1[N];
		memset(s, 0, sizeof(s));
		memset(av1, 0, sizeof(av1));
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				cin >> s[i].arr[j];
				s[i].sum += s[i].arr[j];
				sum += s[i].arr[j];
			}
			s[i].av = s[i].sum * 1.0 / m;
		}
		for (int i = 0; i < n; i++) {
			for ( int j = 0; j < m; j++) {
				av1[j] += s[i].arr[j];
			}
	    }
		for (int i = 0; i < m; i++) {
			av1[i] = av1[i] * 1.0 / n;
		}
		for (int i = 0; i < n - 1; i++) {
			printf("%.2f ", s[i].av);
		}
		printf("%.2f", s[n - 1].av);
		cout << endl;
		for (int i = 0; i < m - 1; i++) {
			printf("%.2f ", av1[i]);
		}
		printf("%.2f", av1[m - 1]);
		cout << endl;
		int count = 0;
		int j;
		for (int i = 0; i < n; i++) {
			int flag = true;
			for (j = 0; j < m; j++) {
				if (s[i].av < av1[j]) {
					flag = false;
				}
			}
			if (flag) {
				count++;
			}
		}
		cout << count << endl;
	}
	return 0;
}